//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "OBOGR_PRIB.h"
#include "DMJ.h"
#include "KART_PRIB.h"
#include "BLANK_POISK.h"
#include "Main.h"
#include "Proc.h"
#include "uProc.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxContainer"
#pragma link "cxControls"
#pragma link "cxEdit"
#pragma link "cxGraphics"
#pragma link "cxGroupBox"
#pragma link "cxLookAndFeelPainters"
#pragma link "cxLookAndFeels"
#pragma link "cxButtons"
#pragma link "cxClasses"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDataStorage"
#pragma link "cxDBData"
#pragma link "cxFilter"
#pragma link "cxGrid"
#pragma link "cxGridCustomTableView"
#pragma link "cxGridCustomView"
#pragma link "cxGridDBTableView"
#pragma link "cxGridLevel"
#pragma link "cxGridTableView"
#pragma link "cxStyles"
#pragma link "DBAccess"
#pragma link "IBC"
#pragma link "MemDS"
#pragma resource "*.dfm"
TfrOBOGR_PRIB *frOBOGR_PRIB;
//---------------------------------------------------------------------------
__fastcall TfrOBOGR_PRIB::TfrOBOGR_PRIB(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrOBOGR_PRIB::AddExecute(TObject *Sender)
{
dmProc->POISK_KART(3,1,0);
}
//---------------------------------------------------------------------------

void __fastcall TfrOBOGR_PRIB::EditExecute(TObject *Sender)
{
Redakt();
}
//---------------------------------------------------------------------------
void __fastcall TfrOBOGR_PRIB::Redakt()
{
frKART_PRIB= new TfrKART_PRIB(this);
frKART_PRIB->TIP=2;
frKART_PRIB->KOD_PRIB=dmOne->IBQTwo->FieldByName("KOD_PRIB")->AsInteger;
frKART_PRIB->ADD=0;
frKART_PRIB->NOM=dmOne->IBQTwo->FieldByName("NOM_ABON")->AsInteger;
frKART_PRIB->ZAPOLNI();
frKART_PRIB->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TfrOBOGR_PRIB::sgKOTELDBTableView1DblClick(TObject *Sender)
{
Redakt();
}
//---------------------------------------------------------------------------

void __fastcall TfrOBOGR_PRIB::sgKOTELDBTableView1KeyDown(TObject *Sender,
      WORD &Key, TShiftState Shift)
{
  if (Key == VK_RETURN){
  Redakt();
	}
}
//---------------------------------------------------------------------------
void __fastcall TfrOBOGR_PRIB::Otkl_PribExecute(TObject *Sender)
{
//frKART_PRIB_VDGO->Stat=2;
//frKART_PRIB_VDGO->TIP=2;
//frKART_PRIB_VDGO->STAT_OTKL=1;
//frKART_PRIB_VDGO->VID=dsetKOTEL->FieldByName("VID_PRIB")->AsInteger;
//frKART_PRIB_VDGO->KOD_PRIB=dsetKOTEL->FieldByName("KOD_KOTEL")->AsInteger;
//frKART_PRIB_VDGO->NOM_ABON=dsetKOTEL->FieldByName("NOM_ABON")->AsInteger;
//frKART_PRIB_VDGO->Obnovi();
//frKART_PRIB_VDGO->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TfrOBOGR_PRIB::FormShow(TObject *Sender)
{
dmProc->INF_PO_PRIB(2);
}
//---------------------------------------------------------------------------

void __fastcall TfrOBOGR_PRIB::actESCExecute(TObject *Sender)
{
 frOBOGR_PRIB->Close();
}
//---------------------------------------------------------------------------

